//
//  CLVCPage.m
//  CLBrowser
//
//  Created by 梁慧聪 on 2022/5/15.
//

#import "CLVCPage.h"
#import "CLPageTopView.h"
#import "CLPageBottomView.h"
@interface CLVCPage ()<UIPageViewControllerDelegate,UIPageViewControllerDataSource,UIGestureRecognizerDelegate>
{
    CGSize _contentSize;
}
@property (nonatomic, strong) UIPageViewController *pageViewController;
@property (nonatomic, strong) CLPageTopView *topView;
@property (nonatomic, strong) CLPageBottomView *bottomView;

@end

@implementation CLVCPage

- (void)viewDidLoad {
    [super viewDidLoad];
    self.pageViewController = [[UIPageViewController alloc]init];
    self.pageViewController.delegate = self;
    self.pageViewController.dataSource = self;
    [self.contentView addSubview:self.pageViewController.view];
    [self addChildViewController:self.pageViewController];
    [self.pageViewController.view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView);
    }];
}

- (nullable UIViewController *)pageViewController:(nonnull UIPageViewController *)pageViewController viewControllerAfterViewController:(nonnull UIViewController *)viewController {
    if ([self.delegate respondsToSelector:_cmd]) {
        return [self.delegate pageViewController:pageViewController viewControllerAfterViewController:viewController];
    }
    return nil;
}

- (nullable UIViewController *)pageViewController:(nonnull UIPageViewController *)pageViewController viewControllerBeforeViewController:(nonnull UIViewController *)viewController {
    if ([self.delegate respondsToSelector:_cmd]) {
        return [self.delegate pageViewController:pageViewController viewControllerBeforeViewController:viewController];
    }
    return nil;
}


@end
